home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / CLR_ALL.DMO < prev    next >
Text File  |  1996-07-04  |  11KB  |  181 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   CLR_ALL .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │         ...........................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16.  
  17.    This demo has been constructed to put the DAS-NBT0.PBL into action. That
  18.    is the one where the mouse is turned OFF/ON when you call the TprintXXX
  19.    and TBoxXXX routines. As the clear screen subs all run through a series
  20.    of loops and make, in some cases, thousands of calls the mouse cursor
  21.    has a tendency to "flicker" just a bit, but it is all so fast that the
  22.    flicker looks better (if you can see it) than an explicit OFF/ON.
  23.  
  24.    Selection "A" does this so you can see the difference and decide for
  25.    yourself how you want your programs to act. If you feel the mouse call
  26.    is better you can simply add MouseOFF and MouseON in each routine then
  27.    re-compile them or make the calls directly from your programs.
  28.  
  29.    Just for demo purposes I've put the mouse to work with an Event. Don't
  30.    get too excited here as I didn't do a full menu for the keyboard so
  31.    things are a bit "strange" but it all works and shows some neat tricks
  32.    you can do using the DASoft libraries and some simple ASM code.
  33.  
  34.                                                  "No brag, just fact!"
  35.                                                      Walter Brennon
  36. $endif
  37.  
  38. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  39. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  40. $STACK  2048
  41. $STRING    8
  42. $OPTIMIZE SIZE
  43.  
  44. $INCLUDE "DAS-NB01.INC"
  45. $INCLUDE "DAS-NB02.INC"
  46. $INCLUDE "DAS-NBT0.INC"  ' the one with the mouse stuff
  47. $INCLUDE "DAS-NBT1.INC"
  48. $INCLUDE "DAS-NBT4.INC"
  49. '───────────────────────────────────────────────┐
  50. FileSpec$ = "DMO\DASLOGO.DAT"                  '│ CORRECT?
  51. '───────────────────────────────────────────────┤
  52. fMouseSetup 0                                  '│ get the mouse stuff ready
  53. EventSetup 2, 30                               '│ get the event handler ready
  54. DIM E?(3,18)                                   '│ our menu has 18 items
  55. Row? = 15     : Col? =  7                      '│
  56. E?(0,0) = 16  : E?(1,0) =  7                   '│ the array is from 0 -> 18
  57. E?(2,0) = 25  : E?(3,0) = 74                   '│ where E?(x,0) are the
  58. FOR H% = 1 TO 18                               '│ outside box parameters
  59.   IF (H% MOD 9) > 0 THEN                       '│
  60.       INCR Row?, 1                             '│
  61.     ELSE                                       '│
  62.       INCR Row?, 2                             '│
  63.   END IF                                       '│
  64.   IF H% = 10 THEN Col? = 43 : Row? = 16        '│
  65.   E?(0,H%) = Row?  : E?(1,H%) = Col?           '│
  66.   E?(2,H%) = Row?  : E?(3,H%) = Col? + 31      '│
  67. NEXT                                           '│
  68. fEventOpenT E?(0,0), 18                        '│ open an event
  69. '───────────────────────────────────────────────┤
  70. '───────────────────────────────────────────────┤
  71. FUNCTION fGetKey% () LOCAL PUBLIC              '│ This is what fGetKey%
  72.   LOCAL G%                                     '│ looks like when using
  73.                                                '│ fEventKey% the only
  74.   DO                                           '│ difference is that it's
  75.     IF INSTAT THEN G%=CVI( INKEY$ + CHR$(0) )  '│ for kbrd and/or mouse
  76.   LOOP UNTIL ( G%             > 0  ) OR _      '│
  77.              ( fMouseGetKey% <> 0  )           '│ change this to > 0
  78.   FUNCTION = G%                                '│ if you only want
  79.                                                '│ clicks
  80. END FUNCTION                                   '│
  81. '───────────────────────────────────────────────┤
  82. '───────────────────────────────────────────────┤
  83. SCREEN 0,,2,0                                  '│ use Apage 2
  84. IF DIR$( FileSpec$ ) = "" THEN                 '│ just in case
  85.     TBoxFILL 1, 1, 25, 80, 177, 7              '│ fill Apage 2
  86.   ELSE                                         '│
  87.     OPEN "B", #1, FileSpec$                    '│ read in the data
  88.     GET$ #1, 4005, Scrn$                       '│ that was stored
  89.     TBoxWrite Scrn$                            '│ fTBoxREAD$ & write
  90.     CLOSE                                      '│ to Apage 2
  91.     Scrn$ = ""                                 '│ don't need this anymore
  92. END IF                                         '│
  93. '───────────────────────────────────────────────┤
  94. MouseONnow                                     '│
  95. SCREEN 0,,0,0                                  '│ working on Apage 0 now
  96. Push? = 0                                      '│
  97. Ltrs$ = "ABCDEFGHQIJKLMNOPZ"                   '│
  98. G$    = "A"                                    '│
  99. DO                                             '│
  100.   TBoxCopy 1, 1, 25, 80, 2, 0                  '│ copy page 2 to page 0
  101.   Hit% = MAX( 1, INSTR( Ltrs$, G$ ) )          '│
  102.   EventClear                                   '│ clear keyboard and mouse
  103.   DO                                           '│
  104.     H% = ABS( Hit% )                           '│
  105.     TBoxColorB E?(0,H%), E?(1,H%), 1, 32, 1    '│ just change the background
  106.     G% = fEventKey%( Hit%, "" )                '│ clear kbrd & wait for a key
  107.     TBoxColorB E?(0,H%), E?(1,H%), 1, 32, 0    '│ ditto.. change it back
  108.   LOOP UNTIL G% <> 0 OR Hit% > 0               '│
  109.   IF Hit% > 0 THEN                             '│
  110.       G$ = MID$("ABCDEFGHQIJKLMNOPZ", Hit%,1)  '│
  111.     ELSEif ( G% > 0 ) AND ( G% < 255 ) THEN    '│
  112.       G$ = UCASE$( CHR$(G%) )                  '│
  113.   END IF                                       '│
  114.   SELECT CASE G$                               '│
  115.     CASE CHR$(027),"Q" : EXIT LOOP             '│
  116.     CASE "Z"           : IF Push? = 0 THEN     '│ because we are storing the
  117.                              Push? = 1         '│ menu screen on page 2 we
  118.                              G$ = "ON "        '│ have to write the change
  119.                            ELSE                '│ to that screen by 1st
  120.                              Push? = 0         '│ setting the Apage to 2
  121.                              G$ = "OFF"        '│ then we go back to Apage 0
  122.                          END IF                '│ There really are easier
  123.                          SCREEN 0,,2,0         '│ ways to do all of this but
  124.                          Tprint 25, 56, G$, 0  '│ as a demo it shows how to
  125.                          SCREEN 0,,0,0         '│ use the Apage with Tprint
  126.                          ITERATE               '│
  127.     CASE "A"                                   '└────────┐
  128.                 asm mov ax,&h02                         ;│mouse off
  129.                 asm int &h33                            ;│ it doesn't get any
  130.                 ClearTBoxBL   1,1,25,80,32,7            '│ cheaper than this!
  131.                 asm mov ax,&h01                         ;│   try it sometime
  132.                 asm int &h33                            ;│mouse on
  133.     CASE "B"  : ClearTBoxBR   1, 1, 25, 80, 32, 7       '│
  134.     CASE "C"  : ClearTBoxTL   1, 1, 25, 80, 32, 7       '│
  135.     CASE "D"  : ClearTBoxTR   1, 1, 25, 80, 32, 7       '│
  136.     CASE "E"  : ClearTBoxRND  1, 1, 25, 80, 32, 7       '│
  137.     CASE "F"  : ClearTBoxVBH  1, 1, 25, 80, 32, 7